package com.guobox.movies.proxy;

import com.guobox.movies.constant.Constant;

import okhttp3.HttpUrl;

/**
 * Created by xuxinlei on 2017/7/13.
 */

public class HttpUrls {


    public static final String Pic_Middle = "middle";

    public static final String Pic_Large = "large";


    private static HttpUrl.Builder getServerURL() {
        return new HttpUrl.Builder()
                .scheme(Constant.HTTP)
                .host(Constant.HOST);
    }

    public static HttpUrl.Builder getMoviePosterURL(String movieId, String picSize) {
        HttpUrl.Builder builder = getServerURL();
        builder.addPathSegment("interface");
        builder.addPathSegment("file.action");
        builder.addQueryParameter("action", "gethbpic");
        builder.addQueryParameter("movieId", movieId);
        builder.addQueryParameter("size", picSize);
        return builder;

    }

    public static HttpUrl.Builder getMovieStageURL(String movieId, String stageId, String picSize) {

        return getServerURL()
                .addPathSegment("interface")
                .addPathSegment("file.action")
                .addQueryParameter("action", "getstagepic")
                .addQueryParameter("movieId", movieId)
                .addQueryParameter("filename", stageId)
                .addQueryParameter("size", picSize);
    }

    public static HttpUrl.Builder getMoviesMeta(String movieId) {
        return getServerURL()
                .addPathSegment("interface")
                .addPathSegment("data.action")
                .addQueryParameter("agent", "stb")
                .addQueryParameter("action", "getfilminfo")
                .addQueryParameter("name", "ymm01")
                .addQueryParameter("movieId", movieId);

    }
    public static HttpUrl.Builder getAppUpdateUrl() {
        return getServerURL().addPathSegment("appstore")
                .addPathSegment("getlastestapp.action")
                .addQueryParameter("appid", Constant.APPID);
    }

    public static HttpUrl.Builder getNasURL(String ip) {
        return new HttpUrl.Builder()
                .scheme(Constant.HTTP)
                .host(ip)
                .port(6100)
                .addEncodedPathSegment("media");
    }


}
